package com.example.xw.common.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.xw.common.entity.Comment;
import com.example.xw.common.service.fallback.FallbackCommentServiceImpl;
import com.example.xw.common.vo.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(value="xw-weibo",contextId="myCommentServiceImpl",fallback = FallbackCommentServiceImpl.class)
public interface CommentService {
    //添加评论
    @GetMapping("/cm/add")
    public Result<Comment> addComment(
            @RequestParam("wbid") int wbid
            , @RequestParam("content")String content
            ,@RequestParam("userloginname")String userloginname);
    //分页查询某篇微博的所有评论
    @GetMapping("/cm/findbywb")
    public Result<Page<Comment>> showListByWeibo(
            @RequestParam("wbid")int wbid, @RequestParam("pagenum")int pageNum
            , @RequestParam("pagesize")int pageSize, @RequestParam("state")int state);
    //分页查询某人发表过的评论
    @GetMapping("/cm/findbyuser")
    public Result<Page<Comment>> showListByUser(
            @RequestParam("userloginname")String userloginname,@RequestParam("pagenum")int pageNum
            ,@RequestParam("pagesize")int pageSize,@RequestParam("state")int state);
    //删除评论
    @GetMapping("/cm/del")
    public Result<Integer> removeComment(@RequestParam("cmid")int cmid);
}
